package com.woniuxy.infrastructure.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 物业抄表记录
 * @TableName meter_reading
 */
@TableName(value ="meter_reading")
@Data
public class MeterReading implements Serializable {
    /**
     * 记录ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 房间ID
     */
    private Integer roomId;

    /**
     * 业主ID
     */
    private Integer ownerId;

    /**
     * 表类型(水/电/气)
     */
    private String meterType;

    /**
     * 表号(可选)
     */
    private String meterNumber;

    /**
     * 上次读数
     */
    private BigDecimal lastRead;

    /**
     * 本次读数
     */
    private BigDecimal currentRead;

    /**
     * 抄表日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date readDate;

    /**
     * 抄表员
     */
    private String reader;

    /**
     * 单价(元)
     */
    private BigDecimal price;
    /**
     * 状态：0未支付，1已支付
     */
    private Integer status;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        MeterReading other = (MeterReading) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getRoomId() == null ? other.getRoomId() == null : this.getRoomId().equals(other.getRoomId()))
            && (this.getOwnerId() == null ? other.getOwnerId() == null : this.getOwnerId().equals(other.getOwnerId()))
            && (this.getMeterType() == null ? other.getMeterType() == null : this.getMeterType().equals(other.getMeterType()))
            && (this.getMeterNumber() == null ? other.getMeterNumber() == null : this.getMeterNumber().equals(other.getMeterNumber()))
            && (this.getLastRead() == null ? other.getLastRead() == null : this.getLastRead().equals(other.getLastRead()))
            && (this.getCurrentRead() == null ? other.getCurrentRead() == null : this.getCurrentRead().equals(other.getCurrentRead()))
            && (this.getReadDate() == null ? other.getReadDate() == null : this.getReadDate().equals(other.getReadDate()))
            && (this.getReader() == null ? other.getReader() == null : this.getReader().equals(other.getReader()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getRoomId() == null) ? 0 : getRoomId().hashCode());
        result = prime * result + ((getOwnerId() == null) ? 0 : getOwnerId().hashCode());
        result = prime * result + ((getMeterType() == null) ? 0 : getMeterType().hashCode());
        result = prime * result + ((getMeterNumber() == null) ? 0 : getMeterNumber().hashCode());
        result = prime * result + ((getLastRead() == null) ? 0 : getLastRead().hashCode());
        result = prime * result + ((getCurrentRead() == null) ? 0 : getCurrentRead().hashCode());
        result = prime * result + ((getReadDate() == null) ? 0 : getReadDate().hashCode());
        result = prime * result + ((getReader() == null) ? 0 : getReader().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", roomId=").append(roomId);
        sb.append(", ownerId=").append(ownerId);
        sb.append(", meterType=").append(meterType);
        sb.append(", meterNumber=").append(meterNumber);
        sb.append(", lastRead=").append(lastRead);
        sb.append(", currentRead=").append(currentRead);
        sb.append(", readDate=").append(readDate);
        sb.append(", reader=").append(reader);
        sb.append(", price=").append(price);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}